<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">

    function object(O) {
        function Fun() {}
        // 将传入的对象做为Fun的原型
        Fun.prototype = O
        return new Fun()
    }
    // object函数不是必须的，任何能返回对象的函数都可以
    function createAnother(original) {
        var clone = object(original)
        clone.sayHello = function () {
            console.log('hello')
        }
        return clone
    }
    var person = {
        name: 'jackson',
        job: ['会计', 'web 前端']
    }
    var anotherPerson = createAnother(person)
    anotherPerson.sayHello()

</script>

</body>
</html>
